from uuid import uuid4
from app import db


class DeviceDataUploadLog(db.Model):
    __tablename__ = "device_data_upload_logs"
    __table_args__ = {"schema": "AeroSentinel"}
    id = db.Column(db.String(36), primary_key=True, default=lambda: str(uuid4()))
    device_id = db.Column(db.String(255), nullable=False)
    upload_time = db.Column(db.DateTime, nullable=False)


class UserOperationLog(db.Model):
    __tablename__ = "user_operation_logs"
    __table_args__ = {"schema": "AeroSentinel"}
    id = db.Column(db.String(36), primary_key=True, default=lambda: str(uuid4()))
    user_id = db.Column(db.String(36), nullable=False)
    operation_type = db.Column(db.String(50), nullable=False)  # 如设备升级、参数调整等
    operation_time = db.Column(db.DateTime, nullable=False)
    device_id = db.Column(db.String(255))  
    details = db.Column(db.Text)  # 操作详情